package logic

import (
	"api/pkg"
	"context"
	"time"

	"api/internal/svc"
	"api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type MobileLoginLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewMobileLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MobileLoginLogic {
	return &MobileLoginLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *MobileLoginLogic) MobileLogin(req *types.MobileLoginRequest) (resp *types.Response, err error) {
	token, _ := pkg.GetJwtToken("2206a", time.Now().Unix(), 86400, "1")
	return &types.Response{
		Code: 0,
		Msg:  "登录成功",
		Data: map[string]interface{}{
			"token": token,
		},
	}, nil
}
